{% extends "layout.html" %}
{% block content %}
<div class="container">
    <div style="margin-top: 20px" class="clearfix">
        <a class="btn btn-primary" href="/admin/add/" role="button" target="_blank">
        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-square" viewBox="0 0 16 16">
  <path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"></path>
  <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4z"></path>
</svg>
            新建管理员
        </a>
         <form method="GET" class="float-right form-inline">
            <div class="form-group mx-sm-3 mb-2">
                <label for="searchInput" class="sr-only">用户名</label>
                <input
                    type="text"
                    id="searchInput"
                    name="search"
                    placeholder="用户名"
                    value="{{ request.GET.search }}"
                    class="form-control"
                >
            </div>
            <button type="submit" class="btn btn-secondary btn-sm mb-2">
                <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
  <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"></path>
</svg>
            </button>
        </form>


    </div>
{% if search_message %}
    <div class="alert alert-warning mt-3" role="alert">
        {{ search_message }}
    </div>
    {% endif %}
<table class="table" style="margin-top: 20px">
  <thead>
    <tr>
      <th scope="col">id</th>
      <th scope="col">用户名</th>
      <th scope="col">密码</th>
        <th scope="col">操作</th>
    </tr>
  </thead>
  <tbody>
    {% for obj in queryset %}
    <tr>
      <th scope="row">{{ obj.id }}</th>
        <td>{{ obj.username }}</td>
        <td>*******</td>

      <td>
          <a class ="btn btn-primary btn-xs" href="/admin/{{ obj.id }}/edit/">编辑</a>
          <a class ="btn btn-danger btn-xs" href="{% url 'admin_delete' %}?nid={{ obj.id }}">删除</a>
      </td>
    </tr>
    {% endfor %}

  </tbody>

</table>
{% include "pagination.html" %}
</div>
{% endblock %}